function addIndexBannerDialog(callback = Function()) {
    const $form = $(`
        <form class="mask-account">
            <div style="margin: 0">
                <span class="mask-account-tit"><sub style="color: red;">*</sub>标题</span>
                <span class="input-select"><input type="text" name="title" placeholder="请输入标题" /></span>
            </div>
            <div>
                <span class="mask-account-tit"><sub style="color: red;">*</sub>广告图片</span>
                <div class="input-select" style="border: 0;padding: 0">
                    <input type="hidden" name="imgUrl">
                </div>
            </div>
            
            <div>
                <span class="mask-account-tit">广告地址</span>
                <span class="input-select"><input type="text" name="targetUrl" placeholder="请输入广告地址" /></span>
            </div>
            
            <div>
                <span class="mask-account-tit">排序</span>
                <span class="input-select"><input type="number" value="10" name="sortIndex" placeholder="请输入排序,小的排前面" /></span>
            </div>
           
        </form>
    `)

    const $imgUrlInput = $form.find('input[name="imgUrl"]');

    $imgUrlInput.after(getUploadImgWidget({
        maxCount: 1,
        maxSize: 1024 * 5,
        callback(urlList) {
            $imgUrlInput.val(urlList.join(","))
        }
    }));

    const $dialogWidget = $.dialog($form, {
        title: "新增首页广告",
        width: "600px",
        ok: () => {
            const data = $.getFormData($form);

            addIndexBanner(data, res => {
                const {Code, Message} = res;
                if (Code !== 10000) {
                    return $.toast(Message);
                }

                $dialogWidget.remove();
                $.toast("添加成功");
                callback();
            })

            return false;
        }
    })

    function addIndexBanner(param, callback = Function()) {
        return $.sApi({
            data: param,
            url: "/api/IndexBanner/addIndexBanner"
        }, callback)
    }
}